package com.cost.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cost.domain.ok.R;
import com.cost.domain.vo.TreeViewVo;

@Controller
@RequestMapping("/treeView")
public class TreeViewCotroller {

	@ResponseBody
	@RequestMapping(value="/list")
	public R viewLst(){
		List<TreeViewVo> root = new ArrayList<TreeViewVo>();
		TreeViewVo t1 = new TreeViewVo();
		t1.setId(0);
		t1.setText("系统管理");
		t1.setSequence(t1.getText());
		List<TreeViewVo> t1List = new ArrayList<TreeViewVo>();
		t1.setNodes(t1List);
		
		TreeViewVo t2 = new TreeViewVo();
		t2.setId(1);
		t2.setText("用户管理");
		t2.setSequence(t1.getText());
		t2.setHref("/user/view");
		TreeViewVo t3 = new TreeViewVo();
		t3.setId(2);
		t3.setText("角色管理");
		t3.setSequence(t1.getText());
		t3.setHref("/role/view");
		t1List.add(t2);
		t1List.add(t3);
		root.add(t1);
		
		return new R.Builder().setData(root).build();
	}
}
